//
//  NSFileManager+Tool.m
//  SLDemo
//
//  Created by bocai on 2016/12/20.
//  Copyright © 2016年 Heracles. All rights reserved.
//

#import "NSFileManager+Tool.h"

@implementation NSFileManager (Tool)

+ (CGFloat)t_fileSizeWithPath:(NSString *)path
{
    NSFileManager *fileManager = [NSFileManager defaultManager];
    CGFloat fileSize = -1.0;
    
    if ([fileManager fileExistsAtPath:path]) {
        NSDictionary *dictionary = [fileManager attributesOfItemAtPath:path error:nil];
        CGFloat size = [dictionary[NSFileSize] doubleValue];
        fileSize = size / 1024 / 1024;
    }
    
    return fileSize;
}

@end
